/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// package com.alibaba.druid.util;

// import java.io.*;
// import java.lang.management.ManagementFactory;
// import java.security.MessageDigest;
// import java.security.NoSuchAlgorithmException;
// import java.text.SimpleDateFormat;
// import java.util.time_t;
// import java.util.Properties;
// import java.util.std::set;

#pragma once
#include <string>
#include <set>
#include "common_ptr.h"

class Utils
{
public:
  static int DEFAULT_BUFFER_SIZE;

  // static string_ptr  read(InputStream in) ;

  static string_ptr readFromResource(string_ptr resource);

  static char *readByteArrayFromResource(string_ptr resource);

  // static char* readByteArray(InputStream input) ;

  // static long copy(InputStream input, OutputStream output);

  // static string_ptr  read(Reader reader) ;

  // static string_ptr  read(Reader reader, int length);

  static string_ptr toString(time_t date);

  // static string_ptr  getStackTrace(Throwable ex) ;

  // static string_ptr  toString(StackTraceElement[] stackTrace) ;

  // static bool getBoolean(Properties properties, string_ptr  key) ;

  // static int getInteger(Properties properties, string_ptr  key) ;

  // static long getLong(Properties properties, string_ptr  key) ;

  // static Class<?> loadClass(string_ptr  className) ;

  static time_t startTime;

  static time_t getStartTime();

  static long murmurhash2_64(string_ptr text);

  /**
   * murmur hash 2.0, The murmur hash is a relatively fast hash function from http://murmurhash.googlepages.com/ for
   * platforms with efficient multiplication.
   *
   * @author Viliam Holub
   */
  static long murmurhash2_64(char *data, int length, int seed);

  static char *md5Bytes(string_ptr text);

  static string_ptr md5(string_ptr text);

  static void putLong(char *b, int off, long val);

  // static bool equals(Object_ptr  a, Object_ptr  b) ;

  static string_ptr hex(int hash);

  static string_ptr hex(long hash);

  static string_ptr hex_t(long hash);

  static long fnv_64(string_ptr input);

  static long fnv_64_lower(string_ptr key);

  static long fnv_32_lower(string_ptr key);

  static void loadFromFile(string_ptr path, std::set<string_ptr> set);
};
